import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
		{
			path: '/',
			name: 'home',
			component: resolve => require(['@/pages/home/Home'], resolve)
		},
		{
			path: '/city',
			name: 'City',
			component: resolve => require(['@/pages/city/City'], resolve)
		},
		{
			path: '/detail/:id',
			name: 'Detail',
			component: resolve => require(['@/pages/detail/Detail'], resolve)
		},
  ],
  scrollBehavior (to, from, savedPosition) { // 切换页面的时候始终让页面回到最顶部
		return { x: 0, y: 0 }
  }
})
